package com.homedo.odin.solution.model.dto;

public class PageBean {

    private int currentPage;
    private int pageSize;
    private static final int DEFAULT_CURRENT_PAGE = 1;
    private static final int DEFAULT_PAGE_SIZE = 10;

    public PageBean(Integer currentPage, Integer pageSize) {
        if (currentPage == null || currentPage <= 0) {
            currentPage = 1;
        }

        if (pageSize == null || pageSize <= 0) {
            pageSize = 10;
        }

        this.currentPage = currentPage;
        this.pageSize = pageSize;
    }

    public int getCurrentPage() {
        return this.currentPage;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public int getFirstIndex() {
        return (this.currentPage - 1) * this.pageSize;
    }
}
